package cn.csxw.openchina.ui.activity;

import android.graphics.Color;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;

import java.util.ArrayList;

import butterknife.BindView;
import cn.csxw.openchina.R;
import cn.csxw.openchina.base.BaseActivity;
import cn.csxw.openchina.base.BaseContentPagerAdapter;
import cn.csxw.openchina.base.BaseRefreshFragment;
import cn.csxw.openchina.ui.fragment.myMessageFragment.MyCommentFragment;
import cn.csxw.openchina.ui.fragment.myMessageFragment.MyFansFragment;
import cn.csxw.openchina.ui.fragment.myMessageFragment.MyMachineFragment;
import cn.csxw.openchina.ui.fragment.myMessageFragment.MyMessageFragment;
import cn.csxw.openchina.ui.fragment.myMessageFragment.MyPraiseFragment;

/**
 * 我的------》消息
 */
public class MyMessageActivity extends BaseActivity {
    @BindView(R.id.tableLayout)
    TabLayout mTableLayout;
    @BindView(R.id.viewPager)
    ViewPager mViewPager;
    String[] title ={"@我","评论","留言","粉丝","赞过我"};
    ArrayList<BaseRefreshFragment> mFragments = new ArrayList<>();
    private BaseContentPagerAdapter mAdapter;

    @Override
    public int getLayoutRes() {
        return R.layout.activity_exercise;
    }

    @Override
    public void initView() {
        mFragments.add(new MyMessageFragment());//@我
        mFragments.add(new MyCommentFragment());//评论
        mFragments.add(new MyMachineFragment());//留言
        mFragments.add(new MyFansFragment());//粉丝
        mFragments.add(new MyPraiseFragment());//赞过我



        if (mAdapter==null){
            mAdapter = new BaseContentPagerAdapter(getSupportFragmentManager());
            mViewPager.setAdapter(mAdapter);
            mTableLayout.setTabTextColors(R.color.spinner_background_press, Color.BLUE);
            mTableLayout.setupWithViewPager(mViewPager);
        }
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {
            mAdapter.setSwipeList(mFragments,title);
    }

    @Override
    public void onClick(View v, int id) {

    }

}
